//
//  ScopeTopUpTableViewCell.m
//  JxCarios
//
//  Created by phev on 15/2/28.
//  Copyright (c) 2015年 xiongchuanqi. All rights reserved.
//

#import "ScopeTopUpTableViewCell.h"
#define Point @"1234567890/n"

@implementation ScopeTopUpTableViewCell

- (void)awakeFromNib {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
}

- (void)setVb:(NSString *)vb {
    if (vb) {
        _vb = [vb copy];
        _currenScope.text = [_vb stringByAppendingString:@"积分"];

    }
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [self endEditing:YES];
    return YES;
}

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
        NSString * toBeString = [textField.text stringByReplacingCharactersInRange:range withString:string];
    
    NSCharacterSet *cs;
    cs = [[NSCharacterSet characterSetWithCharactersInString:Point]invertedSet];
    NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs]componentsJoinedByString:@""]; //按cs分离出数组,数组按@""分离出字符串
    BOOL canChange = [string isEqualToString:filtered];
    if (canChange) {
//        if ([toBeString integerValue] > [_vb integerValue]) {
//            return NO;
//        }
    }else{
        return NO;
    }
     if (_target && _action) {
        [_target performSelector:_action withObject:toBeString];
    }
    return YES;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
